home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 016a / setbus.zip / SETBUS.C < prev    next >
C/C++ Source or Header  |  1991-12-27  |  2KB  |  62 lines

  1. /* setbus : set AT bus data width for tseng based svga cards to 
  2. either 8 or 16 operation.  Most useful for Windows developers using 
  3. two monitors for CodeView debugging. By default, if there is a monochrome 
  4. (or other second monitor on the AT bus, the svga card operates at only 
  5. 8 bits doubling video time.
  6.  
  7. This program allows the user to tell the svga card to use 16-bit data paths
  8. which doubles video perforamce.  This improvement is nearly complete, as 
  9. verified by the PC Labs Windows Graphics benchmark test.
  10.  
  11. Some programs, such as pcANYWHERE IV and Microsoft's CV and CVW, will
  12. only operate when the bus is in 8-bit mode.  
  13. Changing the mode within a DOS virtual session under Windows is not 
  14. sufficient to allow these programs to operate properly.  SETBUS must
  15. be executed before Windwos for these programs to function.
  16.  
  17. The source for this code was downloaded from the STB section of the
  18. GRAHICSVENDOR forum on Compuserv.  The original author is unknown.
  19. This is offered as-is. No claims attached. 
  20. It has been tested with an Orchid Pro Designer II card, probably works with 
  21. STB's Tseng based cards, and may work with other Tseng cards.
  22.  
  23. Uploaded by Pat Farrell, aka pfarrell@gmuvax2.gmu.edu on the Internet.
  24. */
  25.  
  26.  
  27. #include <stdio.h>
  28.  
  29. main(argc, argv)
  30.    int argc;
  31.    char *argv[];
  32.    {
  33.    int crtc, val;
  34.  
  35.    if (inp(0x3CC) & 0x01)
  36.       crtc = 0x3D4;
  37.    else
  38.       crtc = 0x3B4;
  39.  
  40.    outp(0x3BF, 0x03);
  41.    outp(crtc+4, 0xA0);
  42.    outp(crtc, 0x36);
  43.    val = inp(crtc+1);
  44.  
  45.    if (argc == 2) {
  46.       if (strcmp(argv[1], "16") == 0)
  47.          outp(crtc+1, val | 0x40);
  48.       else if (strcmp(argv[1], "8") == 0)
  49.          outp(crtc+1, val & 0xBF);
  50.       else
  51.          goto usage;
  52.       }
  53.    else
  54.       goto usage;
  55.    exit(0);
  56.  
  57. usage:
  58.    fprintf(stderr, "Usage: SETBUS 16\n");
  59.    fprintf(stderr, "   or  SETBUS 8\n");
  60.    exit(1);
  61.    }
  62.